package com.ruoyi.project.system.bundleapplication.service.impl;

import com.ruoyi.common.utils.text.Convert;
import com.ruoyi.project.system.bundleapplication.domain.BundleApplication;
import com.ruoyi.project.system.bundleapplication.mapper.BundleApplicationMapper;
import com.ruoyi.project.system.bundleapplication.service.IBundleApplicationService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.Date;
import java.util.List;
import java.util.UUID;

/**
 * 捆绑企业申请Service业务层处理
 *
 * @author LCL
 * @date 2022-01-04
 */
@Service
public class BundleApplicationServiceImpl implements IBundleApplicationService
{
    @Autowired
    private BundleApplicationMapper bundleApplicationMapper;

    /**
     * 查询捆绑企业申请
     *
     * @param id 捆绑企业申请ID
     * @return 捆绑企业申请
     */
    @Override
    public BundleApplication selectBundleApplicationById(String id)
    {
        return bundleApplicationMapper.selectBundleApplicationById(id);
    }

    /**
     * 查询捆绑企业申请列表
     *
     * @param bundleApplication 捆绑企业申请
     * @return 捆绑企业申请
     */
    @Override
    public List<BundleApplication> selectBundleApplicationList(BundleApplication bundleApplication)
    {
        return bundleApplicationMapper.selectBundleApplicationList(bundleApplication);
    }

    /**
     * 新增捆绑企业申请
     *
     * @param bundleApplication 捆绑企业申请
     * @return 结果
     */
    @Override
    public int insertBundleApplication(BundleApplication bundleApplication)
    {
        bundleApplication.setId((UUID.randomUUID().toString().replace("-","")));
        bundleApplication.setApplyDate(new Date());
        bundleApplication.setStatus(0);
        bundleApplication.setDelFlag(0);
        return bundleApplicationMapper.insertBundleApplication(bundleApplication);
    }

    /**
     * 修改捆绑企业申请
     *
     * @param bundleApplication 捆绑企业申请
     * @return 结果
     */
    @Override
    public int updateBundleApplication(BundleApplication bundleApplication)
    {
        return bundleApplicationMapper.updateBundleApplication(bundleApplication);
    }

    /**
     * 删除捆绑企业申请对象
     *
     * @param ids 需要删除的数据ID
     * @return 结果
     */
    @Override
    public int deleteBundleApplicationByIds(String ids)
    {
        return bundleApplicationMapper.deleteBundleApplicationByIds(Convert.toStrArray(ids));
    }

    /**
     * 删除捆绑企业申请信息
     *
     * @param id 捆绑企业申请ID
     * @return 结果
     */
    @Override
    public int deleteBundleApplicationById(String id)
    {
        return bundleApplicationMapper.deleteBundleApplicationById(id);
    }

    @Override
    public BundleApplication selectBundleApplicationByMemberId(String memberId) {
        return bundleApplicationMapper.selectBundleApplicationByMemberId(memberId);
    }
}
